package com.opensourceedge.phonebook.cli;

import com.opensourceedge.phonebook.api.Contact;
import com.opensourceedge.phonebook.api.FileStore;
import com.opensourceedge.phonebook.api.Store;

public class AddContactCommand implements Command {

	Contact newContact;
	static String COMMAND="add";
	public static String helpText;

	public AddContactCommand() {
		newContact = new Contact();
		helpText="'"+COMMAND+"' to add Contact.";
	}

	@Override
	public void execute() {
		newContact=new Contact();
		Util.addContactCLI(newContact);
		Store cs = new FileStore("contacts.txt");
		cs.insert(newContact);
		System.out.println("<<Success>> Done");
	}

	@Override
	public String getCommandCode() {
		return COMMAND;
	}

	@Override
	public String getCommandHelpText() {
		return helpText;
	}

}
